package com.searchschool.bean;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity (name="USER")
@Table (name="tbuser")
public class User implements Serializable {
	
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue ( strategy=GenerationType.TABLE, generator="USER_GEN")
	@TableGenerator(name="USER_GEN", table="tbsequence", pkColumnName="SEQ_NAME", valueColumnName="SEQ_COUNT", pkColumnValue="USER", allocationSize=1	)
	
	private int iduser;


	public User() {
		super();
	}

	public User(int iduser, String nameuser, School school) {
		super();
		this.iduser = iduser;
		this.nameuser = nameuser;
		this.school = school;
	}

	private String nameuser;
	@OneToOne ( optional=true, cascade=CascadeType.ALL, mappedBy="user" , targetEntity=School.class)
	private School school;
	public School getSchool() {
		return school;
	}

	public void setSchool(School school) {
		this.school = school;
	}

	public int getIduser() {
		return iduser;
	}

	public void setIduser(int iduser) {
		this.iduser = iduser;
	}

	public String getNameuser() {
		return nameuser;
	}

	public void setNameuser(String nameuser) {
		this.nameuser = nameuser;
	}
}
